#include"stdafx.h"
#include<iostream>
using namespace std;

typedef struct stu {
	int data;
	stu *next;
}node;

typedef struct quen {
	node *first;
	node *rear;
}queue;

queue *hq;

void insert(int a);
void dele();
int main3() {
	hq = (queue*)malloc(sizeof(queue));
	hq->first = NULL;
	hq->rear = NULL;
	insert(3);
	insert(4);
	insert(5);
	insert(6);
	while (hq->first!=NULL)
	{
		cout << hq->first->data<<endl;
		hq->first = hq->first->next;
	}
	return 0;
}

void insert(int a)
{
	node *p = (node*)malloc(sizeof(node));
	p->data = a;
	p->next = NULL;
	if (hq->rear == NULL) {
		hq->first = p;
		hq->rear = p;
	}
	else
	{
		hq->rear->next = p;
		hq->rear = p;
	}
}

void dele()
{
	if (hq->first == NULL) {
		cout << "error!"<<endl;
	}
	else
	{
		node *q;
		q = hq->first;
		hq->first = hq->first->next;
		free(hq->first);
	}
}
